/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FenAccueil.java
 *
 * Created on 21 déc. 2011, 17:47:07
 */
package InterfaceGraphique;

import java.awt.Color;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import org.jdesktop.application.Action;

/**
 *
 * @author Arthur
 */
public class FenAccueil extends javax.swing.JFrame {

    private ImagePanel FondFenAccueil;

    /** Creates new form FenAccueil */
    public FenAccueil() {

        initComponents();


        //Initialisation image munchkin
        ImageIcon image = new ImageIcon(getClass().getResource("/images/munchkin1.png"));
        ImageIcon imageRedim = new ImageIcon(image.getImage().getScaledInstance(210, 250, Image.SCALE_DEFAULT));
        this.jLabel3.setIcon(imageRedim);
        ImageIcon image2 = new ImageIcon(getClass().getResource("/images/eclats-1.png"));
        ImageIcon imageRedim2 = new ImageIcon(image2.getImage().getScaledInstance(90, 140, Image.SCALE_DEFAULT));
        this.jLabel2.setIcon(imageRedim2);
        
        ImageIcon image3 = new ImageIcon(getClass().getResource("/images/logo01.png"));
        ImageIcon imageRedim3 = new ImageIcon(image3.getImage().getScaledInstance(300, 100, Image.SCALE_DEFAULT));
        this.jLabel1.setIcon(imageRedim3);
        
        this.setResizable(false);
        this.setSize(780, 600);



        // Mise en forme background fenetre

//        ImageIcon image2 = new ImageIcon(getClass().getResource("/images/motifFOND.jpg"));
//        ImageIcon imageRedim2 = new ImageIcon(image2.getImage().getScaledInstance(851, 639, Image.SCALE_DEFAULT));
//        Image imageFond = imageRedim2.getImage();

//        PanelFond = new ImagePanel(imageFond);
//        this.getContentPane().add(PanelFond);
//        PanelFond.setVisible(true);
        this.getContentPane().setBackground(new Color(237,200,132));
        
  


//        ImageIcon image4 = new ImageIcon(getClass().getResource("/images/fondBOIS.jpg"));
//        ImageIcon imageRedim4 = new ImageIcon(image4.getImage().getScaledInstance(851, 639, Image.SCALE_DEFAULT));
//        Image imageFond = imageRedim4.getImage();
//
//        FondFenAccueil = new ImagePanel(imageFond);
//        MainApplication.DefinirFondFenetre(this, imageFond, FondFenAccueil);
//        initComponents();

        /*ImageIcon image4 = new ImageIcon(getClass().getResource("/images/fondBOIS.jpg"));
        ImageIcon imageRedim4 = new ImageIcon(image4.getImage().getScaledInstance(851, 639, Image.SCALE_DEFAULT));
        Image imageFond = imageRedim4.getImage();

        FondFenAccueil = new ImagePanel(imageFond);
        MainApplication.DefinirFondFenetre(this, imageFond, FondFenAccueil);*/
        //initComponents();


  
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        bNouvPartie = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(237, 200, 132));
        setFocusable(false);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance().getContext().getActionMap(FenAccueil.class, this);
        bNouvPartie.setAction(actionMap.get("lancerNouvellePartie")); // NOI18N
        bNouvPartie.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/nouvelle.png"))); // NOI18N
        bNouvPartie.setName("bNouvPartie"); // NOI18N

        jLabel1.setFont(new java.awt.Font("Kristen ITC", 1, 45));
        jLabel1.setForeground(new java.awt.Color(104, 57, 0));
        jLabel1.setName("jLabel1"); // NOI18N

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/charger.png"))); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("Quitter");
        jButton2.setName("jButton2"); // NOI18N
        jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton2MouseClicked(evt);
            }
        });

        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setName("jLabel3"); // NOI18N

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText("Fichier");
        jMenu1.setName("jMenu1"); // NOI18N

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, 0));
        jMenuItem1.setText("Quitter");
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("A propos");
        jMenu2.setName("jMenu2"); // NOI18N

        jMenuItem2.setText("Art'N'Co");
        jMenuItem2.setName("jMenuItem2"); // NOI18N
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(56, 56, 56)
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 291, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(261, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(189, 189, 189)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 420, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bNouvPartie, javax.swing.GroupLayout.PREFERRED_SIZE, 420, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(211, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(649, Short.MAX_VALUE)
                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(85, 85, 85))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(66, 66, 66)
                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE)
                        .addGap(22, 22, 22))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(46, 46, 46)
                .addComponent(bNouvPartie, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(35, 35, 35)
                .addComponent(jButton2)
                .addGap(50, 50, 50))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-836)/2, (screenSize.height-589)/2, 836, 589);
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        MainApplication.exit();
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
         MainApplication.exit();
    }//GEN-LAST:event_jButton2MouseClicked

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        MainApplication.showPopup();
    }//GEN-LAST:event_jMenuItem2ActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    MainApplication.ChargerPartie();
}//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FenAccueil.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FenAccueil.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FenAccueil.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FenAccueil.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FenAccueil().setVisible(true);
            }
        });
    }

    @Action
    public void lancerNouvellePartie() {
        MainApplication.showCreatpartie();
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bNouvPartie;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    // End of variables declaration//GEN-END:variables
}
